package cn.woblog.android.common.skin.demo;

import android.app.Activity;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import cn.woblog.android.common.skin.core.ThemeManager;

public class BaseActivity extends Activity {
	private static final String TAG = "BaseActivity";

	@Override
	public void setContentView(int layoutResID) {
		super.setContentView(layoutResID);
		init();
	}

	@Override
	public void setContentView(View view) {
		super.setContentView(view);
		init();
	}

	@Override
	public void setContentView(View view, LayoutParams params) {
		super.setContentView(view, params);
		init();
	}

	private void init() {
		initViews();
		initStyle();
		initDatas();
		notifyAdapter();
		bindListener();
	}

	protected void notifyAdapter() {

	}

	protected void bindListener() {

	}

	protected void initDatas() {

	}

	protected void initStyle() {

	}

	protected void initViews() {

	}

	protected void refreshUI() {
		initStyle();
		notifyAdapter();
	}

	@Override
	protected void onResume() {
		if (ThemeManager.isRefreshUI()) {
			Log.d(TAG, "refresh ui");
			refreshUI();
		}
		super.onResume();
	}
}
